import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop0017_添加属性组流程"

#1.打开后台 登录
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
#点击商品管理,商品属性,属性分组
time.sleep(1)
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")
# 2.点击“添加属性组”，编辑属性组名称“好好学习”，属性组排序“1”。
firefox.find_element_by_xpath('//a[contains(.,"添加属性组")]').click()
firefox.find_element_by_id('attribute_group_name').send_keys('好好学习')
firefox.find_element_by_id('attribute_group_sort').clear()
firefox.find_element_by_id('attribute_group_sort').send_keys('1')
# 3.点击“保存属性分组信息”"
firefox.find_element_by_xpath('//button').click()
#断言
a=firefox.find_element_by_xpath('//td[contains(.,"好好学习")]/following-sibling::td[1]/input').get_property('value')
if a=="1":
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()  # 关闭对象
